<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%><%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<tiles:insertDefinition name="layout">
	<tiles:putAttribute name="head">
		<script type="text/javascript">
			$(function() {
				$(".confirm").confirmDialog(function(data) {
					helper.showMsg(data, {
						okHandler : function() {
							location.reload();
						}
					});
				});
			});
		</script>
	</tiles:putAttribute>
	<tiles:putAttribute name="mainBody">
		<s:if test='hasAuthorized("demo.role.write")'>
			<ul class="breadcrumb">
				<li><a href="createRole">创建新角色</a></li>
			</ul>
		</s:if>
		<table class="table">
			<thead>
				<tr>
					<th>名称</th>
					<th>说明</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<s:iterator value="#roles" var="role">
					<tr>
						<td>${role.name}</td>
						<td>${role.title}</td>
						<td><s:url id="listUserUrl" value="../userrole/listUserInRole">
								<s:param value="id" name="id"></s:param>
							</s:url> <a href="${listUserUrl}">
								<i class="icon-user"></i>下属人员
							</a> <s:url id="modifyUserUrl" value="modifyRole">
								<s:param value="id" name="id"></s:param>
							</s:url> <a href="${modifyUserUrl}" title="编辑">
								<i class="icon-pencil"></i>编辑
							</a> <s:url id="removeUserUrl" value="doRemoveRole">
								<s:param value="id" name="id"></s:param>
							</s:url> <a href="${removeUserUrl}" title="删除该角色" class="confirm">
								<i class="icon-remove"></i>删除
							</a> <s:url id="setPrivilege" value="../privilege/setPrivilege">
								<s:param value="id" name="id"></s:param>
							</s:url> <a href="${setPrivilege}" title="设置角色权限">
								<i class="icon-tags"></i>设置权限
							</a></td>
					</tr>
				</s:iterator>
			</tbody>
		</table>
	</tiles:putAttribute>
</tiles:insertDefinition>